3.8 \(\int x \tan ^2(a+b x) \, dx\)

Optimal. Leaf size=30 \[ \frac{\log (\cos (a+b x))}{b^2}+\frac{x \tan (a+b x)}{b}-\frac{x^2}{2} \]

[Out]

-x^2/2 + Log[Cos[a + b*x]]/b^2 + (x*Tan[a + b*x])/b

________________________________________________________________________________________

Rubi [A]  time = 0.0228779, antiderivative size = 30, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.3, Rules used = {3720, 3475, 30} \[ \frac{\log (\cos (a+b x))}{b^2}+\frac{x \tan (a+b x)}{b}-\frac{x^2}{2} \]

Antiderivative was successfully verified.

[In]

Int[x*Tan[a + b*x]^2,x]

[Out]

-x^2/2 + Log[Cos[a + b*x]]/b^2 + (x*Tan[a + b*x])/b

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rubi steps

\begin{align*} \int x \tan ^2(a+b x) \, dx &=\frac{x \tan (a+b x)}{b}-\frac{\int \tan (a+b x) \, dx}{b}-\int x \, dx\\ &=-\frac{x^2}{2}+\frac{\log (\cos (a+b x))}{b^2}+\frac{x \tan (a+b x)}{b}\\ \end{align*}

Mathematica [A]  time = 0.160854, size = 43, normalized size = 1.43 \[ \frac{\log (\cos (a+b x))}{b^2}+\frac{x \tan (a)}{b}+\frac{x \sec (a) \sin (b x) \sec (a+b x)}{b}-\frac{x^2}{2} \]

Antiderivative was successfully verified.

[In]

Integrate[x*Tan[a + b*x]^2,x]

[Out]

-x^2/2 + Log[Cos[a + b*x]]/b^2 + (x*Sec[a]*Sec[a + b*x]*Sin[b*x])/b + (x*Tan[a])/b

________________________________________________________________________________________

Maple [A]  time = 0.072, size = 29, normalized size = 1. \begin{align*} -{\frac{{x}^{2}}{2}}+{\frac{\ln \left ( \cos \left ( bx+a \right ) \right ) }{{b}^{2}}}+{\frac{x\tan \left ( bx+a \right ) }{b}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*tan(b*x+a)^2,x)

[Out]

-1/2*x^2+ln(cos(b*x+a))/b^2+x*tan(b*x+a)/b

________________________________________________________________________________________

Maxima [B]  time = 1.46604, size = 289, normalized size = 9.63 \begin{align*} \frac{2 \,{\left (b x + a - \tan \left (b x + a\right )\right )} a - \frac{{\left (b x + a\right )}^{2} \cos \left (2 \, b x + 2 \, a\right )^{2} +{\left (b x + a\right )}^{2} \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \,{\left (b x + a\right )}^{2} \cos \left (2 \, b x + 2 \, a\right ) +{\left (b x + a\right )}^{2} -{\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right ) - 4 \,{\left (b x + a\right )} \sin \left (2 \, b x + 2 \, a\right )}{\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1}}{2 \, b^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*tan(b*x+a)^2,x, algorithm="maxima")

[Out]

1/2*(2*(b*x + a - tan(b*x + a))*a - ((b*x + a)^2*cos(2*b*x + 2*a)^2 + (b*x + a)^2*sin(2*b*x + 2*a)^2 + 2*(b*x
+ a)^2*cos(2*b*x + 2*a) + (b*x + a)^2 - (cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 + 2*cos(2*b*x + 2*a) + 1)*log
(cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 + 2*cos(2*b*x + 2*a) + 1) - 4*(b*x + a)*sin(2*b*x + 2*a))/(cos(2*b*x
+ 2*a)^2 + sin(2*b*x + 2*a)^2 + 2*cos(2*b*x + 2*a) + 1))/b^2

________________________________________________________________________________________

Fricas [A]  time = 1.55014, size = 96, normalized size = 3.2 \begin{align*} -\frac{b^{2} x^{2} - 2 \, b x \tan \left (b x + a\right ) - \log \left (\frac{1}{\tan \left (b x + a\right )^{2} + 1}\right )}{2 \, b^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*tan(b*x+a)^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*x^2 - 2*b*x*tan(b*x + a) - log(1/(tan(b*x + a)^2 + 1)))/b^2

________________________________________________________________________________________

Sympy [A]  time = 0.31355, size = 41, normalized size = 1.37 \begin{align*} \begin{cases} - \frac{x^{2}}{2} + \frac{x \tan{\left (a + b x \right )}}{b} - \frac{\log{\left (\tan ^{2}{\left (a + b x \right )} + 1 \right )}}{2 b^{2}} & \text{for}\: b \neq 0 \\\frac{x^{2} \tan ^{2}{\left (a \right )}}{2} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*tan(b*x+a)**2,x)

[Out]

Piecewise((-x**2/2 + x*tan(a + b*x)/b - log(tan(a + b*x)**2 + 1)/(2*b**2), Ne(b, 0)), (x**2*tan(a)**2/2, True)
)

________________________________________________________________________________________

Giac [B]  time = 1.52464, size = 246, normalized size = 8.2 \begin{align*} -\frac{b^{2} x^{2} \tan \left (b x\right ) \tan \left (a\right ) - b^{2} x^{2} + 2 \, b x \tan \left (b x\right ) + 2 \, b x \tan \left (a\right ) - \log \left (\frac{4 \,{\left (\tan \left (a\right )^{2} + 1\right )}}{\tan \left (b x\right )^{4} \tan \left (a\right )^{2} - 2 \, \tan \left (b x\right )^{3} \tan \left (a\right ) + \tan \left (b x\right )^{2} \tan \left (a\right )^{2} + \tan \left (b x\right )^{2} - 2 \, \tan \left (b x\right ) \tan \left (a\right ) + 1}\right ) \tan \left (b x\right ) \tan \left (a\right ) + \log \left (\frac{4 \,{\left (\tan \left (a\right )^{2} + 1\right )}}{\tan \left (b x\right )^{4} \tan \left (a\right )^{2} - 2 \, \tan \left (b x\right )^{3} \tan \left (a\right ) + \tan \left (b x\right )^{2} \tan \left (a\right )^{2} + \tan \left (b x\right )^{2} - 2 \, \tan \left (b x\right ) \tan \left (a\right ) + 1}\right )}{2 \,{\left (b^{2} \tan \left (b x\right ) \tan \left (a\right ) - b^{2}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*tan(b*x+a)^2,x, algorithm="giac")

[Out]

-1/2*(b^2*x^2*tan(b*x)*tan(a) - b^2*x^2 + 2*b*x*tan(b*x) + 2*b*x*tan(a) - log(4*(tan(a)^2 + 1)/(tan(b*x)^4*tan
(a)^2 - 2*tan(b*x)^3*tan(a) + tan(b*x)^2*tan(a)^2 + tan(b*x)^2 - 2*tan(b*x)*tan(a) + 1))*tan(b*x)*tan(a) + log
(4*(tan(a)^2 + 1)/(tan(b*x)^4*tan(a)^2 - 2*tan(b*x)^3*tan(a) + tan(b*x)^2*tan(a)^2 + tan(b*x)^2 - 2*tan(b*x)*t
an(a) + 1)))/(b^2*tan(b*x)*tan(a) - b^2)